﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace Fulcrum.ViewModelGenerator.UnitTests
{
    static partial class TestSample3
    {
        public static void ClearValues()
        {
            AttachedIntValidValue = null;

            AttachedIntChangedCalledCount = 0;
            AttachedIntChangedEventArgs = new DependencyPropertyChangedEventArgs();
            AttachedIntObject = null;

            AttachedIntValidateCalledCount = 0;
            AttachedIntValidateValue = Int32.MinValue;

            ROAttachedIntChangedCalledCount = 0;
            ROAttachedIntChangedEventArgs = new DependencyPropertyChangedEventArgs();
            ROAttachedIntObject = null;
        }

        static partial void AttachedIntProperty_PropertyChangedImplementation(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            AttachedIntChangedCalledCount++;
            AttachedIntChangedEventArgs = e;
            AttachedIntObject = o;
        }

        static partial void AttachedIntProperty_ValidatePropertyImplementation(int value, ref bool isValid)
        {
            AttachedIntValidateCalledCount++;
            AttachedIntValidateValue = value;

            if(false == AttachedIntValidValue.HasValue ||
                value == AttachedIntValidValue.Value)
            {
                isValid = true;
            }
            else
            {
                isValid = false;
            }
        }

        static partial void ROAttachedIntProperty_PropertyChangedImplementation(System.Windows.DependencyObject o, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            ROAttachedIntChangedCalledCount++;
            ROAttachedIntChangedEventArgs = e;
            ROAttachedIntObject = o;
        }

        static public int AttachedIntChangedCalledCount
        {
            get;
            private set;
        }

        static public DependencyObject AttachedIntObject
        {
            get;
            private set;
        }

        static public DependencyPropertyChangedEventArgs AttachedIntChangedEventArgs
        {
            get;
            private set;
        }

        static public int AttachedIntValidateCalledCount
        {
            get;
            private set;
        }

        static public int AttachedIntValidateValue
        {
            get;
            private set;
        }

        static public int? AttachedIntValidValue
        {
            get;
            set;
        }

        static public int ROAttachedIntChangedCalledCount
        {
            get;
            private set;
        }

        static public DependencyObject ROAttachedIntObject
        {
            get;
            private set;
        }

        static public DependencyPropertyChangedEventArgs ROAttachedIntChangedEventArgs
        {
            get;
            private set;
        }

        static public void SetROAttachedIntPublic(DependencyObject o, string value)
        {
            SetROAttachedInt(o, value);
        }

    }
}
